package tt.dz.order.vo;

import java.math.BigDecimal;
import java.util.List;

import com.alibaba.druid.util.StringUtils;

/**
 * 修改订单金额VO
 * 
 * @author NIBO
 *
 */
public class OrderItemChangeVo {
	// 验证码
	String checkCode;
	// 订单号
	String orderNo;
	// 修改原因
	String msg;
	// 数据中只包含服务号.运营商号.数量.单价.总价(单价与总价优先使用单价计算)
	List<OrderBaseData> orderBaseDatas;

	public String validationParameters() {
		if (StringUtils.isEmpty(checkCode)) {
			return "请输入验证码";
		}
		if (StringUtils.isEmpty(orderNo)) {
			return "请选择订单";
		}
		if (orderBaseDatas == null || orderBaseDatas.size() <= 0) {
			return "该订单无订单项";
		}
		for (OrderBaseData orderBaseData : orderBaseDatas) {
			if(orderBaseData.getBuyNum()==null||orderBaseData.getBuyNum().intValue()<=0){
				return "订单数量不能小于等于0";
			}
			if(orderBaseData.getUnitPrice()!=null&&orderBaseData.getUnitPrice().intValue()<0){
				return "订单单价不能小于0";
			}
			if(orderBaseData.getTotalPrice()!=null&&orderBaseData.getTotalPrice().intValue()<0){
				return "订单单价不能小于0";
			}
		}
		return null;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public String getCheckCode() {
		return checkCode;
	}

	public void setCheckCode(String checkCode) {
		this.checkCode = checkCode;
	}

	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	public List<OrderBaseData> getOrderBaseDatas() {
		return orderBaseDatas;
	}

	public void setOrderBaseDatas(List<OrderBaseData> orderBaseDatas) {
		this.orderBaseDatas = orderBaseDatas;
	}

}
